﻿using System;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer.stmt
{
	// Token: 0x020000B3 RID: 179
	public class TLoopStmt : TBlockSqlStatement
	{
		// Token: 0x060005D6 RID: 1494 RVA: 0x002FDDA8 File Offset: 0x002FBFA8
		public void setExecuteUsingVars(TExpressionList l)
		{
			this.executeUsingVars = l;
		}

		// Token: 0x060005D7 RID: 1495 RVA: 0x002FDDB1 File Offset: 0x002FBFB1
		public void setExecuteExpr(TExpression e)
		{
			this.executeExpr = e;
		}

		// Token: 0x060005D8 RID: 1496 RVA: 0x002FDDBA File Offset: 0x002FBFBA
		public void setCursorParameterNames(TExpressionList l)
		{
			this.cursorParameterNames = l;
		}

		// Token: 0x060005D9 RID: 1497 RVA: 0x002FDDC3 File Offset: 0x002FBFC3
		public void setReverse(bool b)
		{
			this.isReverse = b;
		}

		// Token: 0x060005DA RID: 1498 RVA: 0x002FDDCC File Offset: 0x002FBFCC
		public void setSelectSqlNode(TSelectSqlNode n)
		{
			this._selectSqlNode = n;
		}

		// Token: 0x060005DB RID: 1499 RVA: 0x002FDDD5 File Offset: 0x002FBFD5
		public void setKind(int i)
		{
			this.kind = i;
		}

		// Token: 0x170000F7 RID: 247
		// (get) Token: 0x060005DD RID: 1501 RVA: 0x002FDDFC File Offset: 0x002FBFFC
		// (set) Token: 0x060005DC RID: 1500 RVA: 0x002FDDDE File Offset: 0x002FBFDE
		public virtual int Kind
		{
			get
			{
				return this.kind;
			}
			set
			{
				this.kind = value;
				if (this.kind == 4)
				{
					this.recordName = this.indexName;
				}
			}
		}

		// Token: 0x060005DE RID: 1502 RVA: 0x002FDE04 File Offset: 0x002FC004
		public TLoopStmt() : this(EDbVendor.dbvoracle)
		{
		}

		// Token: 0x060005DF RID: 1503 RVA: 0x002FDE0E File Offset: 0x002FC00E
		public TLoopStmt(EDbVendor dbvendor) : base(dbvendor)
		{
			this.sqlstatementtype = ESqlStatementType.sst_loopstmt;
		}

		// Token: 0x170000F8 RID: 248
		// (get) Token: 0x060005E0 RID: 1504 RVA: 0x002FDE26 File Offset: 0x002FC026
		// (set) Token: 0x060005E1 RID: 1505 RVA: 0x002FDE2E File Offset: 0x002FC02E
		public virtual TObjectName IndexName
		{
			get
			{
				return this.indexName;
			}
			set
			{
				this.indexName = value;
			}
		}

		// Token: 0x170000F9 RID: 249
		// (get) Token: 0x060005E2 RID: 1506 RVA: 0x002FDE37 File Offset: 0x002FC037
		// (set) Token: 0x060005E3 RID: 1507 RVA: 0x002FDE3F File Offset: 0x002FC03F
		public virtual TObjectName RecordName
		{
			get
			{
				return this.recordName;
			}
			set
			{
				this.recordName = value;
			}
		}

		// Token: 0x170000FA RID: 250
		// (get) Token: 0x060005E5 RID: 1509 RVA: 0x002FDE51 File Offset: 0x002FC051
		// (set) Token: 0x060005E4 RID: 1508 RVA: 0x002FDE48 File Offset: 0x002FC048
		public virtual bool Reverse
		{
			get
			{
				return this.isReverse;
			}
			set
			{
				this.isReverse = value;
			}
		}

		// Token: 0x170000FB RID: 251
		// (get) Token: 0x060005E6 RID: 1510 RVA: 0x002FDE59 File Offset: 0x002FC059
		// (set) Token: 0x060005E7 RID: 1511 RVA: 0x002FDE61 File Offset: 0x002FC061
		public virtual TExpression Upper_bound
		{
			get
			{
				return this.upper_bound;
			}
			set
			{
				this.upper_bound = value;
			}
		}

		// Token: 0x170000FC RID: 252
		// (get) Token: 0x060005E8 RID: 1512 RVA: 0x002FDE6A File Offset: 0x002FC06A
		// (set) Token: 0x060005E9 RID: 1513 RVA: 0x002FDE72 File Offset: 0x002FC072
		public virtual TExpression Lower_bound
		{
			get
			{
				return this.lower_bound;
			}
			set
			{
				this.lower_bound = value;
			}
		}

		// Token: 0x170000FD RID: 253
		// (get) Token: 0x060005EB RID: 1515 RVA: 0x002FDE84 File Offset: 0x002FC084
		// (set) Token: 0x060005EA RID: 1514 RVA: 0x002FDE7B File Offset: 0x002FC07B
		public virtual TSelectSqlStatement Subquery
		{
			get
			{
				return this._subquery;
			}
			set
			{
				this._subquery = value;
			}
		}

		// Token: 0x170000FE RID: 254
		// (set) Token: 0x060005EC RID: 1516 RVA: 0x002FDE8C File Offset: 0x002FC08C
		public virtual TSelectSqlNode SelectSqlNode
		{
			set
			{
				this._selectSqlNode = value;
			}
		}

		// Token: 0x170000FF RID: 255
		// (get) Token: 0x060005EE RID: 1518 RVA: 0x002FDE9E File Offset: 0x002FC09E
		// (set) Token: 0x060005ED RID: 1517 RVA: 0x002FDE95 File Offset: 0x002FC095
		public virtual TExpressionList CursorParameterNames
		{
			get
			{
				return this.cursorParameterNames;
			}
			set
			{
				this.cursorParameterNames = value;
			}
		}

		// Token: 0x060005EF RID: 1519 RVA: 0x002FDEA6 File Offset: 0x002FC0A6
		internal override void buildsql()
		{
		}

		// Token: 0x060005F0 RID: 1520 RVA: 0x002FDEA8 File Offset: 0x002FC0A8
		internal override void clear()
		{
		}

		// Token: 0x060005F1 RID: 1521 RVA: 0x002FDEAA File Offset: 0x002FC0AA
		internal override string getasprettytext()
		{
			return "";
		}

		// Token: 0x060005F2 RID: 1522 RVA: 0x002FDEB1 File Offset: 0x002FC0B1
		internal virtual void iterate(TVisitorAbs pvisitor)
		{
		}

		// Token: 0x060005F3 RID: 1523 RVA: 0x002FDEB3 File Offset: 0x002FC0B3
		public override void init(object arg1)
		{
			this.stmts = (TStatementListSqlNode)arg1;
		}

		// Token: 0x060005F4 RID: 1524 RVA: 0x002FDEC1 File Offset: 0x002FC0C1
		public override void init(object arg1, object arg2)
		{
			this.stmts = (TStatementListSqlNode)arg1;
			if (arg2 is TExpression)
			{
				this.condition = (TExpression)arg2;
				return;
			}
			this.indexName = (TObjectName)arg2;
		}

		// Token: 0x060005F5 RID: 1525 RVA: 0x002FDEF0 File Offset: 0x002FC0F0
		public override void init(object arg1, object arg2, object arg3)
		{
			this.init(arg1, arg2);
			this.cursorName = (TObjectName)arg3;
		}

		// Token: 0x060005F6 RID: 1526 RVA: 0x002FDF06 File Offset: 0x002FC106
		public override void init(object arg1, object arg2, object arg3, object arg4)
		{
			this.init(arg1, arg2);
			this.lower_bound = (TExpression)arg3;
			this.upper_bound = (TExpression)arg4;
		}

		// Token: 0x17000100 RID: 256
		// (get) Token: 0x060005F7 RID: 1527 RVA: 0x002FDF29 File Offset: 0x002FC129
		// (set) Token: 0x060005F8 RID: 1528 RVA: 0x002FDF31 File Offset: 0x002FC131
		public virtual TObjectName CursorName
		{
			get
			{
				return this.cursorName;
			}
			set
			{
				this.cursorName = value;
			}
		}

		// Token: 0x17000101 RID: 257
		// (get) Token: 0x060005F9 RID: 1529 RVA: 0x002FDF3A File Offset: 0x002FC13A
		// (set) Token: 0x060005FA RID: 1530 RVA: 0x002FDF42 File Offset: 0x002FC142
		public virtual TExpression Condition
		{
			get
			{
				return this.condition;
			}
			set
			{
				this.condition = value;
			}
		}

		// Token: 0x17000102 RID: 258
		// (get) Token: 0x060005FC RID: 1532 RVA: 0x002FDF54 File Offset: 0x002FC154
		// (set) Token: 0x060005FB RID: 1531 RVA: 0x002FDF4B File Offset: 0x002FC14B
		public virtual TExpression ExecuteExpr
		{
			get
			{
				return this.executeExpr;
			}
			set
			{
				this.executeExpr = value;
			}
		}

		// Token: 0x17000103 RID: 259
		// (get) Token: 0x060005FE RID: 1534 RVA: 0x002FDF65 File Offset: 0x002FC165
		// (set) Token: 0x060005FD RID: 1533 RVA: 0x002FDF5C File Offset: 0x002FC15C
		public virtual TExpressionList ExecuteUsingVars
		{
			get
			{
				return this.executeUsingVars;
			}
			set
			{
				this.executeUsingVars = value;
			}
		}

		// Token: 0x060005FF RID: 1535 RVA: 0x002FDF70 File Offset: 0x002FC170
		public override int doParseStatement(TCustomSqlStatement psql)
		{
			base.doParseStatement(psql);
			if (this.indexName != null)
			{
				this.TopStatement.SymbolTable.Push(new TSymbolTableItem(9, this, this.indexName));
			}
			if (this.condition != null)
			{
				this.condition.doParse(this, ESqlClause.unknown);
			}
			if (this._subquery != null)
			{
				this._subquery.parsestatement(this, false);
			}
			else if (this._selectSqlNode != null)
			{
				this._subquery = new TSelectSqlStatement(this.dbvendor);
				this._subquery.rootNode = this._selectSqlNode;
				this._subquery.doParseStatement(this);
			}
			this.stmts.doParse(this, ESqlClause.unknown);
			for (int i = 0; i < this.stmts.size(); i++)
			{
				this.BodyStatements.add(this.stmts.getStatementSqlNode(i).Stmt);
			}
			if (this.indexName != null)
			{
				this.TopStatement.SymbolTable.Pop();
			}
			return 0;
		}

		// Token: 0x06000600 RID: 1536 RVA: 0x002FE068 File Offset: 0x002FC268
		public override void accept(TParseTreeVisitor v)
		{
			v.preVisit(this);
			v.postVisit(this);
		}

		// Token: 0x06000601 RID: 1537 RVA: 0x002FE078 File Offset: 0x002FC278
		public override void acceptChildren(TParseTreeVisitor v)
		{
			v.preVisit(this);
			if (this.condition != null)
			{
				this.condition.acceptChildren(v);
			}
			if (this._subquery != null)
			{
				this._subquery.acceptChildren(v);
			}
			this.BodyStatements.acceptChildren(v);
			v.postVisit(this);
		}

		// Token: 0x04001165 RID: 4453
		public const int basic_loop = 1;

		// Token: 0x04001166 RID: 4454
		public const int while_loop = 2;

		// Token: 0x04001167 RID: 4455
		public const int for_loop = 3;

		// Token: 0x04001168 RID: 4456
		public const int cursor_for_loop = 4;

		// Token: 0x04001169 RID: 4457
		private int kind = 1;

		// Token: 0x0400116A RID: 4458
		private TObjectName indexName;

		// Token: 0x0400116B RID: 4459
		private TObjectName recordName;

		// Token: 0x0400116C RID: 4460
		private TStatementListSqlNode stmts;

		// Token: 0x0400116D RID: 4461
		private TExpression lower_bound;

		// Token: 0x0400116E RID: 4462
		private TExpression upper_bound;

		// Token: 0x0400116F RID: 4463
		private bool isReverse;

		// Token: 0x04001170 RID: 4464
		private TSelectSqlStatement _subquery;

		// Token: 0x04001171 RID: 4465
		private TSelectSqlNode _selectSqlNode;

		// Token: 0x04001172 RID: 4466
		private TExpressionList cursorParameterNames;

		// Token: 0x04001173 RID: 4467
		private TObjectName cursorName;

		// Token: 0x04001174 RID: 4468
		private TExpression condition;

		// Token: 0x04001175 RID: 4469
		private TExpression executeExpr;

		// Token: 0x04001176 RID: 4470
		private TExpressionList executeUsingVars;
	}
}
